#!/usr/bin/env bash

ServerName=$1

PackagePath=$2

PackageName=$3

cd /userdata1/tanbao2

rm -rf ${PackageName}*

cp ${PackagePath}/${PackageName}.tar.gz .

tar -xzf ${PackageName}.tar.gz

rm -rf ${PackageName}.tar.gz

#cp 原服务器下的日志
mv ${ServerName}/*.log  ${PackageName}/

rm -rf ${ServerName}

mv ${PackageName} ${ServerName}

cd ${ServerName}/

supervisorctl restart ${ServerName}

sleep 5

check_results=`supervisorctl status`

echo ${check_results}